<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<body>
	<ui:composition template="/template/template.xhtml">
		<ui:define name="title">#{aqarMsgs.Aqarat_Apartments_Apartments_PageTitle}</ui:define>
		<ui:define name="manuBar">
			<ui:include src="/controlling/aqarat/aqaratMenu.xhtml" />
		</ui:define>

		<ui:define name="content">
			<h:form id="apartment_frm">

				<p:panel
					header="#{aqarMsgs.Aqarat_Apartments_Apartments_ApartmentDetails}"
					style="text-align:center">
					<p:panel style="text-align:center">
						<h:panelGrid columns="10">
							<h:outputText value="#{aqarMsgs.Aqarat_Building_Name}" />
							<p:selectOneMenu id="build"
								value="#{apartmentSearchBean.building.recid}">
								<f:selectItem itemLabel="" itemValue="" />
								<f:selectItems value="#{apartmentSearchBean.buildingList}"
									var="build" itemLabel="#{build.name}"
									itemValue="#{build.recid}" />
								<p:ajax process="@this" update="floor"
									listener="#{apartmentSearchBean.loadFloorList}" />
							</p:selectOneMenu>
							<h:outputText value="#{aqarMsgs.Aqarat_Apartments_FloorNo}" />
							<p:selectOneMenu id="floor"
								value="#{apartmentSearchBean.floor.no}">
								<f:selectItem itemLabel="" itemValue="" />
								<f:selectItems value="#{apartmentSearchBean.floorList}"
									var="floor" itemLabel="#{floor.no}" itemValue="#{floor.no}" />
							</p:selectOneMenu>
							<h:outputText
								value="#{aqarMsgs.Aqarat_Apartments_ReservationStatus}" />
							<p:selectOneMenu id="reserve"
								value="#{apartmentSearchBean.apartment.reserveStatus}">
								<f:selectItem itemLabel="" itemValue="" />
								<f:selectItems
									value="#{apartmentSearchBean.reservationStatusList}"
									var="reserve" itemLabel="#{reserve.name}"
									itemValue="#{reserve.recid}" />
							</p:selectOneMenu>
							<h:outputText
								value="#{aqarMsgs.Aqarat_Apartments_ConstructStatus}" />
							<p:selectOneMenu id="construct"
								value="#{apartmentSearchBean.apartment.constructStatus}">
								<f:selectItem itemLabel="" itemValue="" />
								<f:selectItems
									value="#{apartmentSearchBean.constructStatusList}"
									var="construct" itemLabel="#{construct.name}"
									itemValue="#{construct.recid}" />
							</p:selectOneMenu>

							<h:outputText value="#{aqarMsgs.Aqarat_Apartments_TaxesStatus}" />
							<p:selectOneMenu id="taxes"
								value="#{apartmentSearchBean.apartment.taxesStatus}">
								<f:selectItem itemLabel="" itemValue="" />
								<f:selectItems value="#{apartmentSearchBean.taxesStatusList}"
									var="taxess" itemLabel="#{taxess.name}"
									itemValue="#{taxess.recid}" />
							</p:selectOneMenu>
						</h:panelGrid>
						<p:commandButton id="srch_btn"
							value="#{aqarMsgs.Aqarat_General_Search}" icon="ui-icon-search"
							actionListener="#{apartmentSearchBean.searchApartmentList}"
							onstart="waiteDialog.show();" oncomplete="waiteDialog.hide();"
							update="_tap" />
					</p:panel>

					<p:panel id="_tap">
						<p:dataTable id="apartment_tab"
							style="font-size: smaller;text-align: center;width:auto"
							value="#{apartmentSearchBean.apartmentList}" var="apartment"
							paginator="true" rows="10"
							paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
							rowsPerPageTemplate="5,10,15,20,25" lazy="true">

							<p:column style="font-size: small">
								<f:facet name="header">
									<h:outputText value="#{aqarMsgs.Aqarat_Building_Name}" />
								</f:facet>
								<h:outputText value="#{apartment.floor.building.name}" />
							</p:column>
							<p:column style="font-size: small">
								<f:facet name="header">
									<h:outputText value="#{aqarMsgs.Aqarat_Apartments_FloorNo}" />
								</f:facet>
								<h:outputText value="#{apartment.floor.no}" />
							</p:column>
							<p:column style="font-size: smaller">
								<f:facet name="header">
									<h:outputText value="#{aqarMsgs.Aqarat_Apartments_No}" />
								</f:facet>
								<h:outputText value="#{apartment.no}" />
							</p:column>
							<p:column style="font-size: small">
								<f:facet name="header">
									<h:outputText value="#{aqarMsgs.Aqarat_Apartments_Area}" />
								</f:facet>
								<h:outputText value="#{apartment.area}" />
							</p:column>
							<p:column style="font-size: smaller">
								<f:facet name="header">
									<h:outputText
										value="#{aqarMsgs.Aqarat_Apartments_ReservationStatus}" />
								</f:facet>
								<h:outputText value="#{apartment.reservationStatus.name}" />
							</p:column>
							<p:column style="font-size: small">
								<f:facet name="header">
									<h:outputText value="#{aqarMsgs.Aqarat_Apartments_Price}" />
								</f:facet>
								<h:outputText value="#{apartment.price}" />
							</p:column>
							<p:column style="font-size: smaller">
								<f:facet name="header">
									<h:outputText value="#{aqarMsgs.Aqarat_Apartments_SalePrice}" />
								</f:facet>
								<h:outputText value="#{apartment.salePrice}" />
							</p:column>
							<p:column style="font-size: smaller">
								<f:facet name="header">
									<h:outputText
										value="#{aqarMsgs.Aqarat_Apartments_ContractDate}" />
								</f:facet>
								<h:outputText value="#{apartment.contractDate}" />
							</p:column>
							<p:column style="font-size: small">
								<f:facet name="header">
									<h:outputText
										value="#{aqarMsgs.Aqarat_Apartments_NoOfPayments}" />
								</f:facet>
								<h:outputText value="#{apartment.noOfPayments}" />
							</p:column>
							<p:column style="white-space:nowrap;font-size: small">
								<f:facet name="header">
									<h:outputText value="#{aqarMsgs.Aqarat_Apartments_TaxesStatus}" />
								</f:facet>
								<h:outputText value="#{apartment.taxessStatus.name}" />
							</p:column>
							<p:column exportable="false"
								headerText="#{aqarMsgs.Aqarat_General_Options}"
								style="white-space:nowrap;font-size: small;text-align: center;width:auto">
								<p:commandButton value="#{aqarMsgs.Aqarat_General_View}"
									action="#{apartmentSearchBean.toApartmentDetails}"
									onstart="waiteDialog.show();"
									style="white-space:nowrap;text-align: center;font-size: smaller">
									<f:setPropertyActionListener
										target="#{apartmentSearchBean.apartment}" value="#{apartment}" />
								</p:commandButton>
								<p:commandButton
									value="#{aqarMsgs.Aqarat_Apartments_Apartments_Sale}"
									action="#{apartmentSearchBean.toSaleApartment}"
									disabled="#{apartment.reserveStatus == 3}"
									onstart="waiteDialog.show();"
									style="width: 40px;font-size: smaller">
									<f:setPropertyActionListener
										target="#{apartmentSearchBean.apartment}" value="#{apartment}" />
								</p:commandButton>
								<p:spacer width="5" />
								<p:commandButton
									value="#{aqarMsgs.Aqarat_Apartments_Apartments_Payments}}"
									disabled="#{apartment.reserveStatus == 4}"
									action="#{apartmentSearchBean.toCustomerPayments}"
									onstart="waiteDialog.show();"
									style="white-space:nowrap;text-align: center;font-size: smaller">
									<f:setPropertyActionListener
										target="#{apartmentSearchBean.apartment}" value="#{apartment}" />
								</p:commandButton>
							</p:column>
							<f:facet name="footer">
								<h:commandLink>
									<p:graphicImage value="/resources/images/excel.png"
										style="border:0px;" alt="Apartment" />
									<p:dataExporter type="xls" target="apartment_tab"
										fileName="Apartment" />
								</h:commandLink>
							</f:facet>
						</p:dataTable>

					</p:panel>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</body>
</html>
